Block device input/output scheduling algorithm for traditional operating systems (e.g., Linux and windows) is for optimizing input/output performance of a hard disk driver (HDD) so that a mechanical head moves towards one direction continuously to the greatest extent so as to reduce seeking and positioning time overhead of the mechanical head.
With the development of technology, solid state disks and SD cards (Secure Digital Memory Cards) both using flash particles begin to replace HDD having a mechanical head. The main difference from HDD lies in that flash particles do not need seeking and positioning overhead that the mechanical head requires. However, the interior of a flash memory needs to operate a garbage collection operation at the background and erase useless data chunks so as to make space for a following write operation.
In a test, it is found that there is a matching conflict happening between the block device scheduling algorithm of an operating system and the timely garbage recycle of a flash memory. The conflict goes as follows: continuously write an SD card, 64 KB every time, with random write addresses. After a period of time, tens of times of sequential wire operations happen, each with time consumption more than 3 seconds, and even the time consumption of several write operations is as long as tens of seconds. After 1-2 minutes, it reverts to short normal and then recurs again. In a highly real-time data collection application scenario, such write operation with long-lasting continuous overlong time consumption will cause data buffering block, resulting in a serious real-time data loss accident.